package top.huhuiyu.teachproject.exception;

public class AppException extends RuntimeException {
  private int code;

  public int getCode() {
    return code;
  }

  public void setCode(int code) {
    this.code = code;
  }

  public AppException(String message) {
    super(message);
    this.code = 500;
  }

  public AppException(int code, String message) {
    super(message);
    this.code = code;
  }

  public static AppException getInstance(String message) {
    return new AppException(message);
  }

  public static AppException getInstance(int code, String message) {
    return new AppException(code, message);
  }
}
